//
//  TabBarController.m
//  BuyOfNoWane
//
//  Created by qianfeng02 on 15/7/3.
//  Copyright (c) 2015年 迷茫的尧尧. All rights reserved.
//

#import "TabBarController.h"
#import "ApplistController.h"
@interface TabBarController ()

@end

@implementation TabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tabBarController.tabBar.tintColor =kCustomRed;
    [self createControllers];
}
-(void)createControllers
{
    NSArray *urlArr = @[kCellUrl,kDiscountUrl,kBuyOverseasUrl,kFoundUrl,kNewsUrl];
    NSArray *categoryarr=@[kSelectedType,kDiscountType,kBuyoverseaType,kFoundType,kNewsType];
    NSArray *controlArr=[NSArray arrayWithObjects:@"MySelectedController",@"DisCountController",@"BuyOverseaController",@"FoundController",@"NewsController", nil];
    NSArray *titlearr=@[@"我精选",@"有优惠",@"海外淘",@"心发现",@"新资讯"];
    NSArray *imagename=@[@"tabbar_appfree_press",@"tabbar_limitfree_press",@"tabbar_reduceprice_press",@"eye_open",@"ic_search_10"];
    NSMutableArray *vcArr=[[NSMutableArray alloc]init];
    for (int i=0; i<controlArr.count; i++) {
        NSString *title=titlearr[i];
        NSString *classname=controlArr[i];
        Class cls=NSClassFromString(classname);
        ApplistController *BaseVC=[[cls alloc]init];
        UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:BaseVC];
        BaseVC.title=title;
        BaseVC.requestUrl=urlArr[i];
        BaseVC.categoryType=categoryarr[i];
    
        nav.tabBarItem.title=title;
        nav.tabBarItem.image=[UIImage imageNamed:imagename[i]];
        
        [vcArr addObject:nav];
    }
    self.tabBar.tintColor = kCustomRed;
    self.viewControllers=vcArr;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
